﻿#include <iostream>
#include <stack>
#include <map>
using namespace std;
bool solve(string s) {
    stack<char> stk;
    map<char, char> mp;
    mp['('] = ')';
    mp['{'] = '}';
    mp['['] = ']';
    mp['<'] = '>';
    for (auto ch : s) {
        if (ch == '(' || ch == '{' || ch == '[' || ch == '<')stk.push(ch);
        else {
            if (!stk.empty() && mp[stk.top()] == ch) {
                stk.pop();
            }
            else return false;
        }
    }
    if (!stk.empty())return false;
    return true;
}
int main()
{
    string s; cin >> s;
    bool res = solve(s);
    if (res) {
        cout << "True";
        return 0;
    }
    cout << "False";
    return 0;
}